<?php

namespace app\admin\controller\mall\oper;

use app\admin\controller\mall\Base;
use fast\Tree;

/**
 * 系统帮助
 *
 * @icon fa fa-circle-o
 */
class Help extends Base
{
    
    /**
     * Help模型对象
     * @var \app\common\model\mall\oper\Help
     */
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\common\model\mall\oper\Help;
        $this->view->assign("statusList", $this->model->getStatusList());
    
        // 必须将结果集转换为数组
        $catList = collection(\app\common\model\mall\oper\Helpcat::order('pid,weigh')->select())->toArray();
        //生成分类树
        Tree::instance()->init($catList);
        //生成权节点的字段为'name'
        $this->catlist = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
        //生成父节点数据，用于表单选择器
        $catdata = [0 => __('None')];
        foreach ($this->catlist as &$v)
        {
        	if (!$v['showis']) continue;
        	$catdata[$v['id']] = $v['name'];
        }
        $this->view->assign('catdata', $catdata);
    }

}
